home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectShow / WebDVD / WebDVDSample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  18.4 KB  |  427 lines

  1. VERSION 5.00
  2. Object = "{38EE5CE1-4B62-11D3-854F-00A0C9C898E7}#1.0#0"; "mswebdvd.dll"
  3. Begin VB.Form frmWebDVDSample 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "WebDVD Sample"
  6.    ClientHeight    =   3930
  7.    ClientLeft      =   -19140
  8.    ClientTop       =   345
  9.    ClientWidth     =   6255
  10.    Icon            =   "WebDVDSample.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   3930
  15.    ScaleWidth      =   6255
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.Frame fraMenus 
  18.       Height          =   3855
  19.       Left            =   60
  20.       TabIndex        =   10
  21.       Top             =   0
  22.       Width           =   6135
  23.       Begin VB.CommandButton cmdResume 
  24.          Caption         =   "Resume"
  25.          Height          =   315
  26.          Left            =   4545
  27.          TabIndex        =   9
  28.          ToolTipText     =   "Resume Playback"
  29.          Top             =   3420
  30.          Width           =   1470
  31.       End
  32.       Begin VB.CommandButton cmdShowMenu 
  33.          Caption         =   "Show Menu"
  34.          Height          =   315
  35.          Left            =   4545
  36.          TabIndex        =   8
  37.          ToolTipText     =   "Show Menu"
  38.          Top             =   3120
  39.          Width           =   1470
  40.       End
  41.       Begin VB.ListBox lstMenus 
  42.          Height          =   1230
  43.          ItemData        =   "WebDVDSample.frx":0442
  44.          Left            =   3840
  45.          List            =   "WebDVDSample.frx":0444
  46.          TabIndex        =   0
  47.          ToolTipText     =   "Select a Menu"
  48.          Top             =   1440
  49.          Width           =   2175
  50.       End
  51.       Begin VB.CommandButton cmdPlay 
  52.          Caption         =   "Play"
  53.          Height          =   315
  54.          Left            =   120
  55.          TabIndex        =   1
  56.          ToolTipText     =   "Play"
  57.          Top             =   3120
  58.          Width           =   975
  59.       End
  60.       Begin VB.CommandButton cmdStop 
  61.          Caption         =   "Stop"
  62.          Height          =   315
  63.          Left            =   1080
  64.          TabIndex        =   2
  65.          ToolTipText     =   "Stop"
  66.          Top             =   3120
  67.          Width           =   975
  68.       End
  69.       Begin VB.CommandButton cmdPause 
  70.          Caption         =   "Pause"
  71.          Height          =   315
  72.          Left            =   2040
  73.          TabIndex        =   3
  74.          ToolTipText     =   "Pause"
  75.          Top             =   3120
  76.          Width           =   975
  77.       End
  78.       Begin VB.CommandButton cmdEject 
  79.          Caption         =   "Eject"
  80.          Height          =   315
  81.          Left            =   3000
  82.          TabIndex        =   4
  83.          ToolTipText     =   "Eject"
  84.          Top             =   3120
  85.          Width           =   1095
  86.       End
  87.       Begin VB.CommandButton cmdActivateButton 
  88.          Caption         =   "Activate Button"
  89.          Height          =   315
  90.          Left            =   120
  91.          TabIndex        =   5
  92.          ToolTipText     =   "Activate button"
  93.          Top             =   3420
  94.          Width           =   1335
  95.       End
  96.       Begin VB.CommandButton cmdPlayPrevChapter 
  97.          Caption         =   "Last Chapter"
  98.          Height          =   315
  99.          Left            =   1425
  100.          TabIndex        =   6
  101.          ToolTipText     =   "Play previous chapter"
  102.          Top             =   3420
  103.          Width           =   1345
  104.       End
  105.       Begin VB.CommandButton cmdPlayNextChapter 
  106.          Caption         =   "Next Chapter"
  107.          Height          =   315
  108.          Left            =   2775
  109.          TabIndex        =   7
  110.          ToolTipText     =   "Play next chapter"
  111.          Top             =   3420
  112.          Width           =   1325
  113.       End
  114.       Begin MSWEBDVDLibCtl.MSWebDVD MSWebDVD1 
  115.          Height          =   2495
  116.          Left            =   120
  117.          TabIndex        =   11
  118.          Top             =   180
  119.          Width           =   3615
  120.          _cx             =   6376
  121.          _cy             =   4401
  122.          DisableAutoMouseProcessing=   0   'False
  123.          BackColor       =   1048592
  124.          EnableResetOnStop=   0   'False
  125.          ColorKey        =   1048592
  126.          WindowlessActivation=   0   'False
  127.       End
  128.       Begin VB.Line Line1 
  129.          X1              =   3840
  130.          X2              =   6000
  131.          Y1              =   1080
  132.          Y2              =   1080
  133.       End
  134.       Begin VB.Label lblDescriptor 
  135.          Caption         =   "This sample demonstrates the use of the Microsoft WebDVD control within a Visual Basic playback application."
  136.      Height          =   795
  137.          Left            =   3840
  138.          TabIndex        =   15
  139.          Top             =   180
  140.          Width           =   2175
  141.       End
  142.       Begin VB.Label lblChoices 
  143.          Caption         =   "Menu Choices:"
  144.          Height          =   195
  145.          Left            =   3840
  146.          TabIndex        =   14
  147.          Top             =   1200
  148.          Width           =   2115
  149.       End
  150.       Begin VB.Label lblTimeTracker 
  151.          Caption         =   "Time Tracker:"
  152.          Height          =   195
  153.          Left            =   120
  154.          TabIndex        =   13
  155.          Top             =   2820
  156.          Width           =   1335
  157.       End
  158.       Begin VB.Label lblTimeTrackerValue 
  159.          Height          =   195
  160.          Left            =   1560
  161.          TabIndex        =   12
  162.          Top             =   2820
  163.          Width           =   2160
  164.       End
  165.    End
  166. Attribute VB_Name = "frmWebDVDSample"
  167. Attribute VB_GlobalNameSpace = False
  168. Attribute VB_Creatable = False
  169. Attribute VB_PredeclaredId = True
  170. Attribute VB_Exposed = False
  171. '*******************************************************************************
  172. '*       This is a part of the Microsoft DXSDK Code Samples.
  173. '*       Copyright (C) 1999-2001 Microsoft Corporation.
  174. '*       All rights reserved.
  175. '*       This source code is only intended as a supplement to
  176. '*       Microsoft Development Tools and/or SDK documentation.
  177. '*       See these sources for detailed information regarding the
  178. '*       Microsoft samples programs.
  179. '*******************************************************************************
  180. Option Explicit
  181. Option Base 0
  182. Option Compare Text
  183. ' **************************************************************************************************************************************
  184. ' * PRIVATE INTERFACE- FORM EVENT HANDLERS
  185.             ' ******************************************************************************************************************************
  186.             ' * procedure name: Form_Load
  187.             ' * procedure description:  Occurs when a form is loaded.
  188.             ' *
  189.             ' ******************************************************************************************************************************
  190.             Private Sub Form_Load()
  191.             On Local Error GoTo ErrLine
  192.             
  193.             With lstMenus
  194.                .AddItem "RootMenu", 0
  195.                .AddItem "TitleMenu", 1
  196.                .AddItem "AudioMenu", 2
  197.                .AddItem "AngleMenu", 3
  198.                .AddItem "ChapterMenu", 4
  199.                .AddItem "SubpictureMenu", 5
  200.             End With
  201.             
  202.             'set the root menu selected
  203.             lstMenus.Selected(0) = True
  204.             Exit Sub
  205.             
  206. ErrLine:
  207.             Err.Clear
  208.             Exit Sub
  209.             End Sub
  210.             
  211.             
  212.             ' ******************************************************************************************************************************
  213.             ' * procedure name: Form_QueryUnload
  214.             ' * procedure description:  Occurs before a form or application closes.
  215.             ' *
  216.             ' ******************************************************************************************************************************
  217.             Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  218.             On Local Error GoTo ErrLine
  219.             
  220.             Select Case UnloadMode
  221.                  Case 0 'vbFormControlMenu
  222.                              Me.Move Screen.Width * 8, Screen.Height * 8
  223.                              Me.Visible = False: Call MSWebDVD1.Stop
  224.                  Case 1 'vbFormCode
  225.                              Me.Move Screen.Width * 8, Screen.Height * 8
  226.                              Me.Visible = False: Call MSWebDVD1.Stop
  227.                  Case 2 'vbAppWindows
  228.                              Me.Move Screen.Width * 8, Screen.Height * 8
  229.                              Me.Visible = False: Call MSWebDVD1.Stop
  230.                  Case 3 'vbAppTaskManager
  231.                              Me.Move Screen.Width * 8, Screen.Height * 8
  232.                              Me.Visible = False: Call MSWebDVD1.Stop
  233.                  Case 4 'vbFormMDIForm
  234.                              Exit Sub
  235.                  Case 5 'vbFormOwner
  236.                              Exit Sub
  237.             End Select
  238.             Exit Sub
  239.             
  240. ErrLine:
  241.             Err.Clear
  242.             Exit Sub
  243.             End Sub
  244. ' **************************************************************************************************************************************
  245. ' * PRIVATE INTERFACE- CONTROL EVENT HANDLERS
  246.             ' ******************************************************************************************************************************
  247.             ' * procedure name: cmdPlay_Click
  248.             ' * procedure description:  Occurs when the user clicks the "Play" command button
  249.             ' *
  250.             ' ******************************************************************************************************************************
  251.             Private Sub cmdPlay_Click()
  252.             On Local Error GoTo ErrLine
  253.             
  254.             'Start playback
  255.             Call MSWebDVD1.Play
  256.             Exit Sub
  257.             
  258. ErrLine:
  259.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  260.             Exit Sub
  261.             End Sub
  262.             
  263.             
  264.             ' ******************************************************************************************************************************
  265.             ' * procedure name: cmdStop_Click
  266.             ' * procedure description:  Occurs when the user clicks the "Stop" command button
  267.             ' *
  268.             ' ******************************************************************************************************************************
  269.             Private Sub cmdStop_Click()
  270.             On Local Error GoTo ErrLine
  271.             
  272.             'stop playback
  273.             Call MSWebDVD1.Stop
  274.             Exit Sub
  275.             
  276. ErrLine:
  277.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  278.             Exit Sub
  279.             End Sub
  280.             
  281.             
  282.             ' ******************************************************************************************************************************
  283.             ' * procedure name: cmdPause_Click
  284.             ' * procedure description:  Occurs when the user clicks the "Pause" command button
  285.             ' *
  286.             ' ******************************************************************************************************************************
  287.             Private Sub cmdPause_Click()
  288.             On Local Error GoTo ErrLine
  289.             'pause playback
  290.             Call MSWebDVD1.Pause
  291.             Exit Sub
  292.             
  293. ErrLine:
  294.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  295.             Exit Sub
  296.             End Sub
  297.             
  298.             
  299.             ' ******************************************************************************************************************************
  300.             ' * procedure name: cmdEject_Click
  301.             ' * procedure description:  Occurs when the user clicks the "Eject" command button
  302.             ' *
  303.             ' ******************************************************************************************************************************
  304.             Private Sub cmdEject_Click()
  305.             On Local Error GoTo ErrLine
  306.             
  307.             'Eject disc from the drive
  308.             Call MSWebDVD1.Eject
  309.             Exit Sub
  310.             
  311. ErrLine:
  312.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  313.             Exit Sub
  314.             End Sub
  315.             
  316.             
  317.             ' ******************************************************************************************************************************
  318.             ' * procedure name: cmdActivateButton_Click
  319.             ' * procedure description:  Occurs when the user clicks the "ActivateButton" command button
  320.             ' *
  321.             ' ******************************************************************************************************************************
  322.             Private Sub cmdActivateButton_Click()
  323.             On Local Error GoTo ErrLine
  324.             'activates the currently selected button (selected button is highlighted)
  325.             Call MSWebDVD1.ActivateButton
  326.             Exit Sub
  327.             
  328. ErrLine:
  329.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  330.             Exit Sub
  331.             End Sub
  332.             
  333.             
  334.             ' ******************************************************************************************************************************
  335.             ' * procedure name: cmdPlayNextChapter_Click
  336.             ' * procedure description:  Occurs when the user clicks the "PlayNextChapter" command button
  337.             ' *
  338.             ' ******************************************************************************************************************************
  339.             Private Sub cmdPlayNextChapter_Click()
  340.             On Local Error GoTo ErrLine
  341.             'takes playback to next chapter within current title
  342.             Call MSWebDVD1.PlayNextChapter
  343.             Exit Sub
  344.             
  345. ErrLine:
  346.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  347.             Exit Sub
  348.             End Sub
  349.             
  350.             
  351.             ' ******************************************************************************************************************************
  352.             ' * procedure name: cmdPlayPrevChapter_Click
  353.             ' * procedure description:  Occurs when the user clicks the "PlayPrevChapter" command button
  354.             ' *
  355.             ' ******************************************************************************************************************************
  356.             Private Sub cmdPlayPrevChapter_Click()
  357.             On Local Error GoTo ErrLine
  358.             'takes playback to previous chapter within current title
  359.             Call MSWebDVD1.PlayPrevChapter
  360.             Exit Sub
  361.             
  362. ErrLine:
  363.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  364.             Exit Sub
  365.             End Sub
  366.             
  367.             
  368.             ' ******************************************************************************************************************************
  369.             ' * procedure name: cmdShowMenu_Click
  370.             ' * procedure description:  Occurs when the user clicks the "ShowMenu" command button
  371.             ' *
  372.             ' ******************************************************************************************************************************
  373.             Private Sub cmdShowMenu_Click()
  374.             On Local Error GoTo ErrLine
  375.             
  376.                 Select Case lstMenus.ListIndex
  377.                     Case 0: Call MSWebDVD1.ShowMenu(3)  'Root
  378.                     Case 1: Call MSWebDVD1.ShowMenu(2)  'Title
  379.                     Case 2: Call MSWebDVD1.ShowMenu(5)  'Audio
  380.                     Case 3: Call MSWebDVD1.ShowMenu(6)  'Angle
  381.                     Case 4: Call MSWebDVD1.ShowMenu(7)  'Chapter
  382.                     Case 5: Call MSWebDVD1.ShowMenu(4)  'Subpicture
  383.                 End Select
  384.             Exit Sub
  385.             
  386. ErrLine:
  387.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  388.             Exit Sub
  389.             End Sub
  390.             
  391.             
  392.             ' ******************************************************************************************************************************
  393.             ' * procedure name: cmdResume_Click
  394.             ' * procedure description:  Occurs when the user clicks the "Resume" command button
  395.             ' *
  396.             ' ******************************************************************************************************************************
  397.             Private Sub cmdResume_Click()
  398.             On Local Error GoTo ErrLine
  399.                 ' Resume playback
  400.                 Call MSWebDVD1.Resume
  401.             Exit Sub
  402.             
  403. ErrLine:
  404.             Call MsgBox(Err.Description, vbOKOnly + vbExclamation + vbApplicationModal, App.Title): Err.Clear
  405.             Exit Sub
  406.             End Sub
  407.             
  408.             ' ******************************************************************************************************************************
  409.             ' * procedure name: MSWebDVD1_DVDNotify
  410.             ' * procedure description:  DVD notification event- occurs when a notification arrives from the dvd control
  411.             ' *
  412.             ' ******************************************************************************************************************************
  413.             Private Sub MSWebDVD1_DVDNotify(ByVal lEventCode As Long, ByVal lParam1 As Variant, ByVal lParam2 As Variant)
  414.             On Local Error GoTo ErrLine
  415.             
  416.             If 282 = lEventCode Then '282 is the event code for the time event
  417.                'pass in param1 to get you the current time-convert to hh:mm:ss:ff format with DVDTimeCode2BSTR API
  418.                If lblTimeTrackerValue.Caption <> CStr(MSWebDVD1.DVDTimeCode2bstr(lParam1)) Then _
  419.                   lblTimeTrackerValue.Caption = CStr(MSWebDVD1.DVDTimeCode2bstr(lParam1))
  420.             End If
  421.             Exit Sub
  422.             
  423. ErrLine:
  424.             Err.Clear
  425.             Exit Sub
  426.             End Sub
  427.